//反向遍历


int lengthOfLastWord(char* s) {
    int index = strlen(s)-1;
    while(s[index] == ' ')
    {
        index--;
    }
    int lastwordlength = 0;
    while(index >= 0 && s[index] !=' ')
    {
        lastwordlength++;
        index--;
    }
    return lastwordlength;
}